package SpringBoot.spring_boot_starter_data_redis.jedis;


import com.titan.core.utils.cache.RedisUtils;
import com.titan.core.utils.data.FormatUtils;

public class TestRedisUtils {
	public static void main(String[] args) {
		try {
		    RedisUtils.init("39.104.96.32", 8003, "hdjt@123456");
		    run();
		} catch(Exception e) {  
		    e.printStackTrace();  
		} finally {
		    RedisUtils.shutdown();
		}
	}
	
	private static void run() throws Exception {
        System.out.println("是否联通："+RedisUtils.getJedis().ping());
        System.out.println("数据库大小："+RedisUtils.getJedis().dbSize());
        
        RedisUtils.incr("test_incr");  
        System.out.println("测试test的值："+RedisUtils.getString("test_incr"));
        
        RedisUtils.set("k1", "value11111111111111");
        System.out.println(RedisUtils.getString("k1"));
        
        RedisUtils.setHash("test_hash", "k1", "值1");
        RedisUtils.setHash("test_hash", "k2", "值2");
        RedisUtils.setHash("test_hash", "k3", "值3");
        System.out.println(FormatUtils.toString(RedisUtils.getHash("test_hash")));
	}
	
	
}
